﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/AgentMaster.Master"
    AutoEventWireup="true" CodeBehind="PropertyComparisonList.aspx.cs" Inherits="whatpricemyhouse.agent.PropertyComparisonList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">

        function mouseOver1(theObj) {
            theObj.src = "../images/button/print_all_with_photo-w.png";
        }
        function mouseOut1(theObj) {
            theObj.src = "../images/button/print_all_with_photo.png";
        }

        function mouseOver2(theObj) {
            theObj.src = "../images/button/print_all_without_photo-w.png";
        }
        function mouseOut2(theObj) {
            theObj.src = "../images/button/print_all_without_photo.png";
        }

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:LoginView ID="LoginView2" runat="server">
        <RoleGroups>
            <asp:RoleGroup Roles="agent">
                <ContentTemplate>
                    <div class="propertyComparisonList">
                        <div class="titleMessage">
                            <asp:Label ID="Label2" runat="server" Text="Admin Area : " CssClass="largeHeaderStep"></asp:Label>
                            <asp:Label ID="Label3" runat="server" Text="Properties" CssClass="largeHeaderTitle"></asp:Label>
                            <div class="hrHolder">
                                <hr />
                            </div>
                            <div class="commandHolder">
                                <asp:HyperLink ID="HyperLink3" runat="server" Target="_blank" NavigateUrl="~/agent/PrintProperty.aspx">
                                    
                                    <img border="0" alt="" src="../images/button/print_all_with_photo.png" 
                    onmouseover="mouseOver1(this)" onmouseout="mouseOut1(this)" />
                                </asp:HyperLink>
                                &nbsp;&nbsp;&nbsp;&nbsp;
                                <asp:HyperLink ID="HyperLink4" runat="server" Target="_blank" NavigateUrl="~/agent/PrintPropertyNoPhoto.aspx">
                                    <img border="0" alt="" src="../images/button/print_all_without_photo.png" 
                    onmouseover="mouseOver2(this)" onmouseout="mouseOut2(this)" />
                                </asp:HyperLink>
                            </div>
                        </div>
                        <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1" EnableModelValidation="True"
                            DataKeyNames="propertyID">
                            <AlternatingItemTemplate>
                                <div class="propertyList">
                                    <div class="leftHolder">
                                        <div class="idNumber">
                                           &nbsp;&nbsp; #<asp:Label ID="Label1" runat="server" Text='<%# Eval("no") %>' />
                                        </div>
                                        <div class="image">
                                            <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("imageUrl") %>' />
                                        </div>
                                    </div>
                                    <div class="rightHolder">
                                        <div class="commandHolder">
                                            <asp:HyperLink ID="HyperLink2" runat="server" CssClass="editButton" NavigateUrl='<%# Eval("propertyID","~/agent/Property.aspx?comm=edit&pid={0}") %>'>Edit</asp:HyperLink>
                                            &nbsp;&nbsp;&nbsp;&nbsp;<asp:HyperLink ID="HyperLink1" runat="server" CssClass="deleteButton" NavigateUrl='<%# Eval("propertyID","~/agent/Property.aspx?comm=delete&pid={0}") %>'>Delete</asp:HyperLink>
                                        </div>
                                        <div class="lines">
                                            <div class="line1">
                                                <asp:Label ID="PlaceNameLabel" runat="server" Text='<%# Eval("suburb") %>' />
                                            </div>
                                            <div class="line2">
                                                <asp:Label ID="streetNumLabel" runat="server" Text='<%# Eval("streetNum") %>' />
                                                &nbsp;<asp:Label ID="addressLabel" runat="server" Text='<%# Eval("address") %>' />
                                            </div>
                                            <div class="line3">
                                                <asp:Label ID="dateOfSaleLabel" runat="server" Text='<%# Eval("dateOfSale","{0:dd/MM/yyyy}") %>' />
                                                -
                                                $<asp:Label ID="priceLabel" runat="server" Text='<%# Eval("price") %>' />
                                            </div>
                                            <div class="line4">
                                                <asp:Label ID="descriptionLabel" runat="server" Text='<%# Eval("description") %>' />
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </AlternatingItemTemplate>
                            <EditItemTemplate>
                                <span style="background-color: #008A8C; color: #FFFFFF;">propertyID:
                                    <asp:Label ID="propertyIDLabel1" runat="server" Text='<%# Eval("propertyID") %>' />
                                    <br />
                                    placeID:
                                    <asp:TextBox ID="placeIDTextBox" runat="server" Text='<%# Bind("placeID") %>' />
                                    <br />
                                    otherLocation:
                                    <asp:TextBox ID="otherLocationTextBox" runat="server" Text='<%# Bind("otherLocation") %>' />
                                    <br />
                                    streetNum:
                                    <asp:TextBox ID="streetNumTextBox" runat="server" Text='<%# Bind("streetNum") %>' />
                                    <br />
                                    address:
                                    <asp:TextBox ID="addressTextBox" runat="server" Text='<%# Bind("address") %>' />
                                    <br />
                                    status:
                                    <asp:TextBox ID="statusTextBox" runat="server" Text='<%# Bind("status") %>' />
                                    <br />
                                    dateOfSale:
                                    <asp:TextBox ID="dateOfSaleTextBox" runat="server" Text='<%# Bind("dateOfSale") %>' />
                                    <br />
                                    price:
                                    <asp:TextBox ID="priceTextBox" runat="server" Text='<%# Bind("price") %>' />
                                    <br />
                                    description:
                                    <asp:TextBox ID="descriptionTextBox" runat="server" Text='<%# Bind("description") %>' />
                                    <br />
                                    imageUrl:
                                    <asp:TextBox ID="imageUrlTextBox" runat="server" Text='<%# Bind("imageUrl") %>' />
                                    <br />
                                    SSIID:
                                    <asp:TextBox ID="SSIIDTextBox" runat="server" Text='<%# Bind("SSIID") %>' />
                                    <br />
                                    UserId:
                                    <asp:TextBox ID="UserIdTextBox" runat="server" Text='<%# Bind("UserId") %>' />
                                    <br />
                                    createDate:
                                    <asp:TextBox ID="createDateTextBox" runat="server" Text='<%# Bind("createDate") %>' />
                                    <br />
                                    <asp:CheckBox ID="isOldCheckBox" runat="server" Checked='<%# Bind("isOld") %>' Text="isOld" />
                                    <br />
                                    no:
                                    <asp:Label ID="noLabel1" runat="server" Text='<%# Eval("no") %>' />
                                    <br />
                                    PlaceName:
                                    <asp:TextBox ID="PlaceNameTextBox" runat="server" Text='<%# Bind("PlaceName") %>' />
                                    <br />
                                    <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
                                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
                                    <br />
                                    <br />
                                </span>
                            </EditItemTemplate>
                            <EmptyDataTemplate>
                                <span>No data was returned.</span>
                            </EmptyDataTemplate>
                            <InsertItemTemplate>
                                <span style="">propertyID:
                                    <asp:TextBox ID="propertyIDTextBox" runat="server" Text='<%# Bind("propertyID") %>' />
                                    <br />
                                    placeID:
                                    <asp:TextBox ID="placeIDTextBox" runat="server" Text='<%# Bind("placeID") %>' />
                                    <br />
                                    otherLocation:
                                    <asp:TextBox ID="otherLocationTextBox" runat="server" Text='<%# Bind("otherLocation") %>' />
                                    <br />
                                    streetNum:
                                    <asp:TextBox ID="streetNumTextBox" runat="server" Text='<%# Bind("streetNum") %>' />
                                    <br />
                                    address:
                                    <asp:TextBox ID="addressTextBox" runat="server" Text='<%# Bind("address") %>' />
                                    <br />
                                    status:
                                    <asp:TextBox ID="statusTextBox" runat="server" Text='<%# Bind("status") %>' />
                                    <br />
                                    dateOfSale:
                                    <asp:TextBox ID="dateOfSaleTextBox" runat="server" Text='<%# Bind("dateOfSale") %>' />
                                    <br />
                                    price:
                                    <asp:TextBox ID="priceTextBox" runat="server" Text='<%# Bind("price") %>' />
                                    <br />
                                    description:
                                    <asp:TextBox ID="descriptionTextBox" runat="server" Text='<%# Bind("description") %>' />
                                    <br />
                                    imageUrl:
                                    <asp:TextBox ID="imageUrlTextBox" runat="server" Text='<%# Bind("imageUrl") %>' />
                                    <br />
                                    SSIID:
                                    <asp:TextBox ID="SSIIDTextBox" runat="server" Text='<%# Bind("SSIID") %>' />
                                    <br />
                                    UserId:
                                    <asp:TextBox ID="UserIdTextBox" runat="server" Text='<%# Bind("UserId") %>' />
                                    <br />
                                    createDate:
                                    <asp:TextBox ID="createDateTextBox" runat="server" Text='<%# Bind("createDate") %>' />
                                    <br />
                                    <asp:CheckBox ID="isOldCheckBox" runat="server" Checked='<%# Bind("isOld") %>' Text="isOld" />
                                    <br />
                                    PlaceName:
                                    <asp:TextBox ID="PlaceNameTextBox" runat="server" Text='<%# Bind("PlaceName") %>' />
                                    <br />
                                    <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />
                                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" />
                                    <br />
                                    <br />
                                </span>
                            </InsertItemTemplate>
                            <ItemTemplate>
                                <div class="propertyList">
                                    <div class="leftHolder">
                                        <div class="idNumber">
                                            &nbsp;&nbsp;#<asp:Label ID="Label1" runat="server" Text='<%# Eval("no") %>' />
                                        </div>
                                        <div class="image">
                                            <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("imageUrl") %>' />
                                        </div>
                                    </div>
                                    <div class="rightHolder">
                                        <div class="commandHolder">
                                            <asp:HyperLink ID="HyperLink2" runat="server" CssClass="editButton" NavigateUrl='<%# Eval("propertyID","~/agent/Property.aspx?comm=edit&pid={0}") %>'>Edit</asp:HyperLink>
                                            &nbsp;&nbsp;&nbsp;&nbsp;<asp:HyperLink ID="HyperLink1" runat="server" CssClass="deleteButton" NavigateUrl='<%# Eval("propertyID","~/agent/Property.aspx?comm=delete&pid={0}") %>'>Delete</asp:HyperLink>
                                        </div>
                                        <div class="lines">
                                            <div class="line1">
                                                <asp:Label ID="PlaceNameLabel" runat="server" Text='<%# Eval("suburb") %>' />
                                            </div>
                                            <div class="line2">
                                                <asp:Label ID="streetNumLabel" runat="server" Text='<%# Eval("streetNum") %>' />
                                                &nbsp;<asp:Label ID="addressLabel" runat="server" Text='<%# Eval("address") %>' />
                                            </div>
                                            <div class="line3">
                                                <asp:Label ID="dateOfSaleLabel" runat="server" Text='<%# Eval("dateOfSale","{0:dd/MM/yyyy}") %>' />
                                                -
                                                $<asp:Label ID="priceLabel" runat="server" Text='<%# Eval("price") %>' />
                                            </div>
                                            <div class="line4">
                                                &nbsp;<asp:Label ID="descriptionLabel" runat="server" Text='<%# Eval("description") %>' />
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </ItemTemplate>
                            <LayoutTemplate>
                                <div id="itemPlaceholderContainer" runat="server" style="font-family: Verdana, Arial, Helvetica, sans-serif;">
                                    <span runat="server" id="itemPlaceholder" />
                                </div>
                                <div class="pager">
                                    <asp:DataPager ID="DataPager1" runat="server">
                                        <Fields>
                                            <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="False" ShowNextPageButton="False"
                                                ShowPreviousPageButton="False" />
                                            <asp:NumericPagerField />
                                            <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="False" ShowNextPageButton="False"
                                                ShowPreviousPageButton="False" />
                                        </Fields>
                                    </asp:DataPager>
                                </div>
                            </LayoutTemplate>
                            <SelectedItemTemplate>
                                <span style="background-color: #008A8C; font-weight: bold; color: #FFFFFF;">propertyID:
                                    <asp:Label ID="propertyIDLabel" runat="server" Text='<%# Eval("propertyID") %>' />
                                    <br />
                                    placeID:
                                    <asp:Label ID="placeIDLabel" runat="server" Text='<%# Eval("placeID") %>' />
                                    <br />
                                    otherLocation:
                                    <asp:Label ID="otherLocationLabel" runat="server" Text='<%# Eval("otherLocation") %>' />
                                    <br />
                                    streetNum:
                                    <asp:Label ID="streetNumLabel" runat="server" Text='<%# Eval("streetNum") %>' />
                                    <br />
                                    address:
                                    <asp:Label ID="addressLabel" runat="server" Text='<%# Eval("address") %>' />
                                    <br />
                                    status:
                                    <asp:Label ID="statusLabel" runat="server" Text='<%# Eval("status") %>' />
                                    <br />
                                    dateOfSale:
                                    <asp:Label ID="dateOfSaleLabel" runat="server" Text='<%# Eval("dateOfSale") %>' />
                                    <br />
                                    price:
                                    <asp:Label ID="priceLabel" runat="server" Text='<%# Eval("price") %>' />
                                    <br />
                                    description:
                                    <asp:Label ID="descriptionLabel" runat="server" Text='<%# Eval("description") %>' />
                                    <br />
                                    imageUrl:
                                    <asp:Label ID="imageUrlLabel" runat="server" Text='<%# Eval("imageUrl") %>' />
                                    <br />
                                    SSIID:
                                    <asp:Label ID="SSIIDLabel" runat="server" Text='<%# Eval("SSIID") %>' />
                                    <br />
                                    UserId:
                                    <asp:Label ID="UserIdLabel" runat="server" Text='<%# Eval("UserId") %>' />
                                    <br />
                                    createDate:
                                    <asp:Label ID="createDateLabel" runat="server" Text='<%# Eval("createDate") %>' />
                                    <br />
                                    <asp:CheckBox ID="isOldCheckBox" runat="server" Checked='<%# Eval("isOld") %>' Enabled="false"
                                        Text="isOld" />
                                    <br />
                                    no:
                                    <asp:Label ID="noLabel" runat="server" Text='<%# Eval("no") %>' />
                                    <br />
                                    PlaceName:
                                    <asp:Label ID="PlaceNameLabel" runat="server" Text='<%# Eval("PlaceName") %>' />
                                    <br />
                                    <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Delete" />
                                    <br />
                                    <br />
                                </span>
                            </SelectedItemTemplate>
                        </asp:ListView>
                        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:WhatPriceMyHouseConnectionString %>"
                            SelectCommand="SELECT market_comparison_property_table.propertyID, market_comparison_property_table.otherLocation, market_comparison_property_table.streetNum, market_comparison_property_table.address, market_comparison_property_table.status, market_comparison_property_table.dateOfSale, market_comparison_property_table.price, market_comparison_property_table.description, market_comparison_property_table.imageUrl, market_comparison_property_table.SSIID, market_comparison_property_table.UserId, market_comparison_property_table.createDate, market_comparison_property_table.isOld, market_comparison_property_table.no, suburbs.suburb, suburbs.area FROM market_comparison_property_table INNER JOIN suburbs ON market_comparison_property_table.suburbid = suburbs.suburbid WHERE (suburbs.area LIKE @area) ORDER BY market_comparison_property_table.no DESC"
                            ConflictDetection="CompareAllValues" DeleteCommand="DELETE FROM [market_comparison_property_table] WHERE [propertyID] = @original_propertyID"
                            OldValuesParameterFormatString="original_{0}">
                            <DeleteParameters>
                                <asp:Parameter Name="original_propertyID" Type="String" />
                            </DeleteParameters>
                            <SelectParameters>
                                <asp:SessionParameter DefaultValue="auckland" Name="area" SessionField="areaName" />
                            </SelectParameters>
                        </asp:SqlDataSource>
                    </div>

                </ContentTemplate>
            </asp:RoleGroup>
        </RoleGroups>
    </asp:LoginView>
</asp:Content>
